﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using SAPBoAddonBBO.DB;

namespace BoAddonBiz_FreightForwarder
{
    public class B1Console : SAPBoAddon.B1BusinessConsole
    {
        public override bool CheckEnvironment()
        {
            return true;
        }

        protected override void RegisterForms()
        {
            foreach (Type t in System.Reflection.Assembly.GetExecutingAssembly().GetTypes())
            {
                if (t.BaseType == typeof(SAPBoAddon.B1Form))
                {
                    if (!t.IsAbstract)
                    {
                        Activator.CreateInstance(t, false);
                    }
                    else
                    {                        
                        foreach (Type tt in System.Reflection.Assembly.GetExecutingAssembly().GetTypes())
                        {
                            if (tt.BaseType == t)
                            {
                                Activator.CreateInstance(tt, false);
                            }
                        }
                    }
                }
            }
            CommonEvents commandevents = new CommonEvents(SboAddon.SBOApp, SboAddon.SBOCompany);
            //SAPBoAddon.B1Form oform = new B1Form_Sample();
            //SAPBoAddon.B1Form oContractform = new B1Form_Contract();
            //SAPBoAddon.B1Form oSurveyform = new B1Form_Survey();
        }

        protected override void RegisterMenus()
        {
            B1Menus oMenu = new B1Menus();
        }

        protected override void RegisterOthers()
        {
            //B1BoDBConnection b1db = new B1BoDBConnection(SboAddon.SBOCompany);
            //IBOFreightForwarder.Basis.IFFBOFactory FFBOFactory = IBOFreightForwarder.FFBOFactorySingleton.GetIntance(SAPBoAddon.B1Addon.B1Addon.FolderWork + "BOFreightForwarder.dll");
            //IBOFreightForwarder.Basis.IFFBORepository Repository = IBOFreightForwarder.FFBOFactorySingleton.GetIntance().NewRepository();
            //Repository.SetBOFactory(FFBOFactory);
            //Repository.SetDBConnection(b1db);
        }
    }
}
